package net.dopan.pigframe.core.base.entity.generator;

import net.dopan.pigframe.core.utils.IdUtils;
import org.springframework.data.keyvalue.core.IdentifierGenerator;
import org.springframework.data.util.TypeInformation;

/**
 * @Package: net.dopan.pigframe.core.base.entity.generator
 * @Title: IdGenerator
 * @Description: 主键生成器
 * @author: 刘宽
 * @date: 2018/8/18 16:21
 */
public class IdGenerator implements IdentifierGenerator {

    /**
     * Generate a new identifier.
     */
    @Override
    public <T> T generateIdentifierOfType(TypeInformation<T> typeInformation) {
        return (T) IdUtils.nextId();
    }
}
